<template>
  <page-body>
    <view class="page">
      <view class="flex benben-position-layout flex flex-wrap align-center pinglun_flex_0"
        :style="{height:(88+StatusBarRpx)+'rpx',paddingTop:StatusBarRpx+'rpx', }">
        <view class='flex flex-wrap align-center justify-between flex-sub pinglun_fd0_0'>
          <view class='flex flex-wrap align-center pinglun_fd0_0_c0' @tap.stop="handleJumpDiy" data-type="back"
            data-url="1">
            <text class='fu-iconfont2  pinglun_fd0_0_c0_c0'>&#xE794;</text>
          </view>
          <view class='flex flex-wrap align-stretch justify-center'>
            <text class='pinglun_fd0_0_c1_c0'>评论</text>
          </view>
          <view class='flex flex-wrap align-center justify-end pinglun_fd0_0_c0'>
          </view>
        </view>

      </view>
      <view :style="{height: (88+StatusBarRpx)+'rpx'}"></view>
      <!---flex布局flex布局开始-->
      <view class="flex flex-direction align-stretch benben-flex-layout pinglun_flex_1">
        <template v-for='(item,key0) in dataList'>
          <view class='flex flex-direction flex-wrap align-stretch pinglun_fd1_0' :key='key0'
            @tap.stop="goHomeFunc(item)">
            <view class='flex flex-wrap align-center flex-sub'>
              <image class='pinglun_fd1_0_c0_c0' mode="aspectFit" :src='item.avatar'>
              </image>
              <view class='flex flex-direction align-stretch flex-sub pinglun_fd1_0_c0_c1'>
                <text>{{item.user_name}}</text>
                <view class='flex flex-wrap align-center pinglun_fd1_0_c0_c1_c1'>
                  <text>评论</text>
                  <text>你的动态</text>
                  <text class='pinglun_fd1_0_c0_c1_c1_c2'>{{item.create_time}}</text>
                </view>
              </view>
              <button class='pinglun_fd1_0_c0_c2' v-if="userInfo.id==item.postUserId"
                @click.stop="openpoe(item)">回复</button>
            </view>
            <view class='pinglun_fd1_0_c1_c1-1'>{{item.title}}</view>
            <view class='flex flex-wrap align-center pinglun_fd1_0_c1'>
              <image class='pinglun_fd1_0_c1_c0' mode="aspectFill" :src='item.thumb || item.video_img'></image>
              <text class='pinglun_fd1_0_c1_c1'>{{item.content}}</text>
            </view>
          </view>
        </template>
        <fu-empty :pagingListLoadedAll="pagingListLoadedAll" :pagingListNoListData="pagingListNoListData"
          :listDataLength="listDataLength" :isLoadInit="isLoadInit"></fu-empty>
      </view>

      <!---flex布局flex布局结束-->
      <benben-popup v-model="popupShow1717472690849" :mask="true" :mask-close-able="false" mode='bottom' :z-index='999'>
        <!---flex布局flex布局开始-->
        <view class="flex flex-wrap align-center justify-between benben-flex-layout chooseCompany_flex_3">
          <benben-input class='chooseCompany_fd3_0' type="text" :placeholder="`请输入`" confirm-type="done" :maxlength="-1"
            :adjust-position='true' v-model="content" placeholder-style="color:#999;font-size:28rpx" />
          <button class='chooseCompany_fd3_1' @click.stop="queryMessageFunc">回复</button>
        </view>

        <!---flex布局flex布局结束-->

      </benben-popup>

    </view>
  </page-body>
</template>
<script>
  import pagingList from '@/common/mixin/paging_list.js';
  import {
    validate
  } from '@/common/utils/validate.js'

  export default {
    components: {},
    mixins: [pagingList],

    data() {
      return {
        popupShow1717472690849: false,
        "minixPagingListsApi": "",
        "pageingListApiMethod": "",
        "allowOnloadGetList": false,
        "dataList": [],
        chooseobj: '',
        content: ''
      };
    },
    computed: {
      isLogin() {
        return this.$store.state.token == '' ? false : true;
      },
      userInfo: {
        get() {
          return this.$store.state.userInfo
        },
        set() {
          this.$store.commit('updateUserInfo', value)
        },
      }
    },
    watch: {},
    onLoad(options) {

    },
    onUnload() {

    },
    onReady() {

    },
    onShow() {
      this.getDataListFunc()
    },
    onHide() {

    },
    onResize() {

    },
    onPullDownRefresh() {

    },
    onReachBottom(e) {

    },
    onPageScroll(e) {

    },
    methods: {
      openpoe(item) {
        this.chooseobj = item
        this.popupShow1717472690849 = true
      },
      async queryMessageFunc() {
        if (this.isLogin === true) {

          if (!validate(this.content, 'require')) {
            this.$message.info(global.i18n.t('请输入评论'));
            return false;
          }
          if (this.content.trim() == '') {
            this.$message.info('请输入评论');
            return false;
          }
          //请求方法
          //数据验证

          let data641ae6a3510c7 = await this.$api.post(global.apiUrls.post645de4549cf17, {
            comment_id: this.chooseobj.comment_id,
            content: this.content
          });
          this.popupShow1717472690849 = false

          if (data641ae6a3510c7.data.code != 1) {
            this.$message.info(data641ae6a3510c7.data.msg);
            return
          }
          let info641ae6a3510c7 = data641ae6a3510c7.data;


          this.$message.info('已回复');
          this.content = '';
          this.getListFunc()
        } else {
          this.$message.info('请先登录');
          this.toLoginDiy();
        }
      },
      //获取赞和收藏列表
      getDataListFunc() {
        this.minixPagingListsApi = global.apiUrls.post665941f49b994;
        this.pageingListApiMethod = 'post';
        this.allowOnloadGetList = false;
        this.pagingListPostDataContent = {}
        this.listData = [];
        this.dataList = this.listData;
        this.pagingListToggle();

      },
      //跳转主页
      goHomeFunc(item) {
        uni.navigateTo({
          url: `/pages/homePage/dongDetail/dongDetail?id=${item.postId}`
        })
        return;
        if (this.userInfo.id == userid) {

        } else {

        }
      },
      pagingListPostData() {
        return this.pagingListPostDataContent
      }
    }
  };
</script>
<style lang="scss" scoped>
  .chooseCompany_flex_3 {
    background: var(--benbenbgColor1);
    padding: 32rpx;
    background-size: 100% auto;
  }

  .chooseCompany_fd3_1 {
    background: #5ECA71;
    border-radius: 44rpx 44rpx 44rpx 44rpx;
    width: 104rpx;
    line-height: 48rpx;
    font-size: 24rpx;
    color: #fff;
    height: 48rpx;
  }

  .chooseCompany_fd3_0 {
    background: #F8F8F8;
    border-radius: 36rpx 36rpx 36rpx 36rpx;
    line-height: 60rpx;
    height: 60rpx;
    padding: 0rpx 0rpx 0rpx 24rpx;
    width: 550rpx;
  }

  .page {
    width: 100vw;
    overflow-x: hidden;
    min-height: calc(100vh - var(--window-bottom));
    background: var(--benbenbgColor1);
    background-size: 100% auto;
  }

  .pinglun_flex_0 {
    background: #fff;
    width: 750rpx;
    height: 88rpx;
    overflow: hidden;
    z-index: 10;
    top: 0rpx;
    background-size: 100% auto !important;
  }

  .pinglun_fd0_0_c1_c0 {
    font-size: 36rpx;
    font-weight: 700;
    color: #333333;
    line-height: 50rpx;
  }

  .pinglun_fd0_0_c0_c0 {
    font-size: 36rpx;
    color: #333;
  }

  .pinglun_fd0_0_c0 {
    width: 120rpx;
  }

  .pinglun_fd0_0 {
    padding: 0rpx 32rpx 0rpx 32rpx;
  }

  .pinglun_flex_1 {
    margin: 20rpx 32rpx 0rpx 32rpx;
  }

  .pinglun_fd1_0_c1_c1 {
    -webkit-line-clamp: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    width: 500rpx;
    margin: 0rpx 0rpx 0rpx 24rpx;
  }

  .pinglun_fd1_0_c1_c1-1 {
    -webkit-line-clamp: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    width: 500rpx;
    margin: 24rpx 0rpx 0rpx 24rpx;
  }

  .pinglun_fd1_0_c1_c0 {
    width: 96rpx;
    height: 96rpx;
    border-radius: 16rpx;
  }

  .pinglun_fd1_0_c1 {
    background: #F6F6F6;
    border-radius: 16rpx 16rpx 16rpx 16rpx;
    width: 654rpx;
    height: 128rpx;
    margin: 24rpx auto 0rpx auto;
    padding: 0rpx 12rpx 0rpx 12rpx;
  }

  .pinglun_fd1_0_c0_c2 {
    background: var(--benbenbgColor2);
    border-radius: 100rpx 100rpx 100rpx 100rpx;
    width: 120rpx;
    line-height: 48rpx;
    font-size: 24rpx;
    color: var(--benbenFontColor3);
    height: 48rpx;
  }

  .pinglun_fd1_0_c0_c1_c1_c2 {
    margin: 0rpx 0rpx 0rpx 12rpx;
    font-size: 26rpx;
  }

  .pinglun_fd1_0_c0_c1_c1 {
    margin: 12rpx 0rpx 0rpx 0rpx;
    color: rgba(102, 102, 102, 1);
  }

  .pinglun_fd1_0_c0_c1 {
    margin: 0rpx 16rpx 0rpx 16rpx;
  }

  .pinglun_fd1_0_c0_c0 {
    width: 100rpx;
    height: 100rpx;
    border-radius: 16rpx;
  }

  .pinglun_fd1_0 {
    border-bottom: 1px solid #eee;
    padding: 24rpx 0rpx 24rpx 0rpx;
  }
</style>
